home *** CD-ROM | disk | FTP | other *** search
/ Enter 2005 October / enter-2005-10.iso / files / jedit42install.exe / {app} / macros / Clipboard / Cut_Selection_or_Line.bsh < prev   
Encoding:
Text File  |  2004-08-29  |  863 b   |  37 lines

  1. /*
  2. * Cut_Selection_or_Line.bsh - a BeanShell macro for jEdit
  3. * which cuts either the selected text, or the current line 
  4. * if no text is selected, to the clipboard.
  5. *
  6. * Copyright (C) 2003 Ollie Rutherfurd <oliver@jedit.org>
  7. *
  8. * $Id: Cut_Selection_or_Line.bsh,v 1.1 2004/08/03 21:31:47 orutherfurd Exp $
  9. */
  10.  
  11. cutSelectionOrLine(){
  12.     selections = textArea.getSelection();
  13.     if(selections.length == 0){
  14.         textArea.smartHome(false);
  15.         textArea.smartEnd(true);
  16.     }
  17.     Registers.cut(textArea,'$');
  18. }
  19.  
  20. if(buffer.isReadOnly())
  21.     Toolkit.getDefaultToolkit().beep();
  22. else
  23.     cutSelectionOrLine();
  24.  
  25. /*
  26.     Macro index data (in DocBook format)
  27.  
  28. <listitem>
  29.     <para><filename>Cut_Selection_or_Line.bsh</filename>
  30.     <abstract><para>
  31.         If no text is selected, the current line is cut to the clipboard,
  32.         otherwise the selected text is cut to the clipboard.
  33.     </para></abstract>
  34. </listitem>
  35.  
  36. */
  37.